//
//  StoreDetailNaviView.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/14.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "StoreDetailNaviView.h"

@implementation StoreDetailNaviView

- (void)refreshNaviFavorStatusWith:(BOOL)isCollect {
    self.isCollect = isCollect;
    switch (self.naviViewStatus) {
        case StoreNaviViewStatusType_clear:{
            if (self.isCollect) {
                [self.favoriteBtn setImage:[UIImage imageNamed:@"store_guanzhu_sel"] forState:UIControlStateNormal];
            } else {
                [self.favoriteBtn setImage:[UIImage imageNamed:@"store_guanzhu"] forState:UIControlStateNormal];
            }
        } break;
        case StoreNaviViewStatusType_white:{
            if (self.isCollect) {
                [self.favoriteBtn setImage:[UIImage imageNamed:@"store_guanzhu_bsel"] forState:UIControlStateNormal];
            } else {
                [self.favoriteBtn setImage:[UIImage imageNamed:@"store_guanzhu_b"] forState:UIControlStateNormal];
            }
        } break;
        default:
            break;
    }
}

- (void)fillWithNaviStatus:(StoreNaviViewStatusType)naviViewStatus isCollect:(BOOL)isCollect alpha:(CGFloat)alpha {

    self.isCollect = isCollect;
    self.naviViewStatus = naviViewStatus;
    [self.naviBgImageView setImage:[Utilities imageWithColor:[[UIColor whiteColor] colorWithAlphaComponent:alpha]]];
    
    switch (naviViewStatus) {
        case StoreNaviViewStatusType_clear:{
            [self.backBtn setImage:[UIImage imageNamed:@"black_fanhui"] forState:UIControlStateNormal];
            [self.shareBtn setImage:[UIImage imageNamed:@"store_fenxiang"] forState:UIControlStateNormal];
            [self.msgBtn setImage:[UIImage imageNamed:@"store_xiaoxi"] forState:UIControlStateNormal];
            if (self.isCollect) {
                [self.favoriteBtn setImage:[UIImage imageNamed:@"store_guanzhu_sel"] forState:UIControlStateNormal];
            } else {
                [self.favoriteBtn setImage:[UIImage imageNamed:@"store_guanzhu"] forState:UIControlStateNormal];
            }
        } break;
        case StoreNaviViewStatusType_white:{
            [self.backBtn setImage:[UIImage imageNamed:@"public_back_black"] forState:UIControlStateNormal];
            [self.shareBtn setImage:[UIImage imageNamed:@"store_fenxiang_b"] forState:UIControlStateNormal];
            [self.msgBtn setImage:[UIImage imageNamed:@"store_xiaoxi_b"] forState:UIControlStateNormal];
            if (self.isCollect) {
                [self.favoriteBtn setImage:[UIImage imageNamed:@"store_guanzhu_bsel"] forState:UIControlStateNormal];
            } else {
                [self.favoriteBtn setImage:[UIImage imageNamed:@"store_guanzhu_b"] forState:UIControlStateNormal];
            }
        } break;
        default:
            break;
    }
}



- (IBAction)backAction:(id)sender {

    if (self.StoreDetailNaviViewBlock) {
        self.StoreDetailNaviViewBlock(StoreDetailNaviViewActionType_back);
    }

}

- (IBAction)favorAction:(id)sender {
    
    if (self.StoreDetailNaviViewBlock) {
        self.StoreDetailNaviViewBlock(StoreDetailNaviViewActionType_favor);
    }
}

- (IBAction)shareAction:(id)sender {
    
    if (self.StoreDetailNaviViewBlock) {
        self.StoreDetailNaviViewBlock(StoreDetailNaviViewActionType_share);
    }
}

- (IBAction)imAction:(id)sender {
    
    if (self.StoreDetailNaviViewBlock) {
        self.StoreDetailNaviViewBlock(StoreDetailNaviViewActionType_im);
    }
}

@end
